package SeparateAnalysis;


/**
 * Created by IntelliJ IDEA.
 * User: Mike
 * Date: 11/24/11
 * Time: 11:08 AM
 * To change this template use File | Settings | File Templates.
 */
public class BottleCalcs {
    Long startTime;
    Long stopTime;
    double rate;
    double startAbv;
    double stopAbv;

    double aveAbv;
    double totalml;

    public BottleCalcs() {
        this.startTime = Data.bottleStartT;
        this.stopTime = System.currentTimeMillis();
        this.rate = (Double.valueOf(Data.flowRate) - Double.valueOf(Data.flowRate1)) / 2.0;
        this.startAbv = Data.bottleabv[Integer.valueOf(Data.bottleS) - 1];
        this.stopAbv = Double.valueOf(Data.vaporAbvS);

        // do the calculations for this round
        this.aveAbv = (startAbv + stopAbv) / 2.0;
        this.totalml = rate * (stopTime - startTime) * (1.0 / 1000.0) * (1.0 / 60.0);
        Data.bottleabv[Integer.valueOf(Data.bottleS) - 1] = this.aveAbv;
        Data.bottleml[Integer.valueOf(Data.bottleS) - 1] = this.totalml;

        // set the values for the next bottle
        Data.bottleabv[Integer.valueOf(Data.bottleS)] = this.stopAbv;
        Data.bottleStartT = stopTime;
        Data.flowRate1 = Data.flowRate;
    }

}
